import 'react-app-polyfill/ie11';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import TimeLine from '../src';

const setTweenFn = frame => {
  const cv = frame.next.info  - frame.previous.info ; //差值
  const ci = frame.next.index - frame.previous.index; //差帧
  const mv = cv / ci;
  return mv * (frame.index - frame.previous.index) + frame.previous.info;
}

const tl = new TimeLine<number>(setTweenFn, [
  [24, 100],
  [56, 200],
  [90, 300]
]);

console.log(tl.getFrameInfo(11))
console.log(tl.getFrameInfo(19))
console.log(tl.getFrameInfo(39))
console.log(tl.getFrameInfo(88))

const App = () => {
  return (
    <div>
      123
    </div>
  );
};

ReactDOM.render(<App />, document.getElementById('root'));
